<%@ page language="java" contentType="text/html; charset=utf-8" pageEncoding="utf-8"%>
<%@ include file="/pages/common/header.jsp"%>
<jdf:themeFile file="business/bankStatement.js" />
</head>
<c:choose>
    <c:when test="${action=='supplier'}">
        <c:set value="对账单确认" var="title"/> 
    </c:when>
    <c:otherwise>
        <c:set value="对账单管理" var="title"/> 
    </c:otherwise>
</c:choose>
<body>
	<div class="contentBody contentborder">
		<div class="tab-pane" id="tabPane">
			<div id="message">${message }</div>
			<div class="tab-page">
				 <h1 class="tab">${title}</h1>
 				 <div class="contentborder">
                	 <jdf:form bean="request" scope="request">
						<form action="${dynamicDomain}/bankStatement/${action}" method="post">
							 <table class="inputTable">
			                 	<tr>
									<td class="label cancelBorderLeft">
										<label for="search_EQI_objectId">对账单编号：</label>
									</td>
									<td class="content">
										<input type="text" name="search_EQI_objectId" />
									</td>
									<td class="label">
                                        <label for="search_GED_generateDate">创建日期：</label>
                                    </td>
                                    <td class="content">
                                        <input type="text" id="search_GED_generateDate" size="12" name="search_GED_generateDate" class="Wdate" onClick="WdatePicker({dateFmt:'yyyy-MM-dd',maxDate:'#F{$dp.$D(\'search_LED_generateDate\')}',readOnly:true})">
                                        ~
                                        <input type="text" id="search_LED_generateDate" size="12" name="search_LED_generateDate" class="Wdate" onClick="WdatePicker({dateFmt:'yyyy-MM-dd',minDate:'#F{$dp.$D(\'search_GED_generateDate\')}',readOnly:true})">
                                    </td>
			                 	</tr>
			                 	<tr>
			                 	    <td class="label cancelBorderLeft">
                                        <label for="search_EQI_supplierId">供应商：</label>
                                    </td>
                                    <td class="content" colspan="3">
                                        <input type="hidden" name="search_EQI_supplierId" id="supplierId"/>
                                        <input type="text" name="supplierName" id="supplierName" size="30"/>
                                        <a href="${dynamicDomain}/supplier/select?ajax=1" class="colorbox">选择</a>
                                    </td>
                                   
			                 	</tr>
			                 	<tr>
                                	<td class="bottomLabel" colspan="4">
                                		<div class="right">
											<button type="reset">重置</button>
											<button type="submit">查询</button>
                                		</div>
									</td>
			                 </table>
			            </form>
			        </jdf:form>
				</div>
				<div class="contentborder listArea">
					<div class="toolBar">
					   <c:if test="${action=='page'}">
		 			      <button type="button" onclick="window.location.href='${dynamicDomain}/bankStatement/create?action=${action}'">增加</button>
		 			   </c:if>
					</div>
					<div id="tableDiv">
						<jdf:table items="items" var="currentRowObject" retrieveRowsCallback="limit" filterRowsCallback="limit" sortRowsCallback="limit" action="${action}">
							<jdf:export view="csv" fileName="对账单.csv" tooltip="Export CSV" imageName="csv" />
							<jdf:export view="xls" fileName="对账单.xls" tooltip="Export EXCEL" imageName="xls" />
							<jdf:row>
								<jdf:column property="objectId" title="对账单编号" style="width: 15%">
								    ${currentRowObject.no}
								</jdf:column>
								<jdf:column property="supplierId" title="供应商" style="width: 18%">
								    <jdf:columnCollectionValue items="suppliers"  nameProperty="name" value="${currentRowObject.supplierId}"/>
								</jdf:column>
								<jdf:column property="generateDate" title="创建日期" style="width: 12%"  cell="date"/>
								<jdf:column property="currency" title="币种" style="width: 5%">
                                    <jdf:columnValue dictionaryId="1006" value="${currentRowObject.currency}"/>
                                </jdf:column>
                                <jdf:column property="status" title="状态" style="width: 7%">
                                    <jdf:columnValue dictionaryId="1009" value="${currentRowObject.status}"/>
                                </jdf:column>
                                <jdf:column property="financeStatus" title="财务状态" style="width: 8%">
                                    <jdf:columnValue dictionaryId="1002" value="${currentRowObject.financeStatus}"/>
                                </jdf:column>
								<jdf:column property="total" title="总金额" style="width: 15%" cell="currency"/>
								<jdf:column alias="操作" sortable="false" viewsAllowed="html" style="width: 20%">
								    <c:if test="${action=='page'}">
								    <c:if test="${currentRowObject.financeStatus == 1 && currentRowObject.status==10}">
								    <a href="javascript:pay(${currentRowObject.objectId},'${action}')" class="button audit">付款</a>
								    </c:if>
									<a href="${dynamicDomain}/bankStatement/edit/${currentRowObject.id}?action=${action}" class="button">修改</a>
									<c:if test="${currentRowObject.status == 1 }">
                                        <a href="javascript:confirmOk(${currentRowObject.objectId},'${action}')" class="button  audit">代确认</a>
                                    </c:if>
                                    <c:if test="${currentRowObject.status == 5 }">
                                        <a href="javascript:audit(${currentRowObject.objectId},'${action}')" class="button  audit">审核通过</a>
                                    </c:if>
									</c:if>
									<a href="${dynamicDomain}/bankStatement/print/${currentRowObject.objectId}?action=${action}" class="button">查看</a>
									<c:if test="${action=='supplier' && currentRowObject.status == 1 }">
										<a href="javascript:confirmOk(${currentRowObject.objectId},'${action}')" class="button  audit">确认</a>
									</c:if>
									<a href="#selectUser" onclick="javascript:currentOrderId=${currentRowObject.objectId};getSupplier(${currentRowObject.supplierId});" class="button audit edit">邮件通知</a>
								    <a href="${dynamicDomain}/bankStatement/download/${currentRowObject.objectId}" class="button">PDF下载</a>
								</jdf:column>
							</jdf:row>
						</jdf:table>
					</div>
				</div>
			</div>
		</div>
	</div>
	
	<div style="display: none;">
        <div id="selectUser" class="contentborder">
            <div id="suberror"></div>
            <div id="subnotice"></div>
            <table class="inputTable">
               <tr>
                   <td class="label cancelBorderLeft" style="width: 20%;"><label>供应商：</label></td>
                   <td class="content">&nbsp;<input type="checkbox" name="customer" value="1" id="customer_1" style="vertical-align: middle;">&nbsp;<label id="customer_2" for="customer_1"></label></td>
               </tr>
               <jsp:include page="/extendUser/selectEmailUsers" flush="true" />
               <tr>
                   <td class="bottomLabel" colspan="2">
                      <div class="right">
                          <button onclick="notify()" id="notifyButton">邮件通知</button>
                      </div>
                  </td>
               </tr>
            </table>
        </div>
    </div>
	<script type="text/javascript">
		$(function() {
	        $(".colorbox").colorbox({iframe:true, innerWidth:700, innerHeight:460});
	        $('.edit').colorbox({ inline:true,innerWidth:500, innerHeight:300,href:'#selectUser'});
	    });
	
		var currentOrderId = null;

	</script>
</body>
</html>